package com.lq.learningTest.File;

import java.io.Serializable;

public class User implements Serializable {
    //自定义标识当前序列化的版本，不设置java会默认给一个
    //保证不会因为修改代码，项目升级，jdk版本不同而导致问题出现
    private static final long serialVersionUID = 666L;
    private String name;
    private transient int age;

    private Dog dog;

    public User() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }

    public User(String name, int age, Dog dog) {
        this.name = name;
        this.age = age;
        this.dog = dog;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", dog=" + dog +
                '}';
    }
}
